import React from "../src/react";
import ReactDOM,{ useState,useEffect } from "../src/react-dom/client";
// import React from "react";
// import ReactDOM from "react-dom/client";
function App (){
  const [ num, setNum ] = useState(1);
  useEffect(() => {
    console.log('useeffect---');
  },[])
  const handleAdd = () => { 
    setNum(num+1);
  }

  return (
    <div>
      <button onClick={handleAdd}>增加</button>
      {num}
    </div>
  )
};

class App1 extends React.Component{
  constructor(props){
    super(props);
    this.state = {
      num : 1
    }
  };
  handleAdd = () => {
    this.setState({
      num: this.state.num+1
    })
  };
  render(){
    return <div>
      <button onClick={this.handleAdd}>增加</button>
      {this.state.num}
    </div>
  }
};

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render( 
  <App />
);
